/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ucm;

import java.sql.ResultSet;
import sql.Select;

/**
 *
 * @author 马凯
 */
public class StudentInfo_UC {
 private static StudentInfo_UC siuc;
    private String receive;
    private String output = "";

    public static StudentInfo_UC getInstance(String receive) {
        if (siuc == null) {
            siuc = new StudentInfo_UC();
            siuc.receive = receive;
        }else
        {
            siuc.receive = receive;
        }
        return siuc;
    }

    public String run() {
        String[] str = receive.split(";");
        String cid = str[0];
        String query = "SELECT 'group',college,major_course FROM student WHERE student_id='" + cid + "';";
        ResultSet rs = Select.getInstance().selectValue(query);
        try {
            if (rs.wasNull()) {
                output = rs.getString("group") + ";07";
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return output;
    }
}
